home *** CD-ROM | disk | FTP | other *** search
- <PUBLIC:HTC URN="tabstrip">
- <PUBLIC:ATTACH EVENT="ondocumentready" HANDLER="DoInit" />
- <PUBLIC:ATTACH EVENT="onclick" HANDLER="DoClick" />
- <PUBLIC:ATTACH EVENT="onmouseover" HANDLER="DoMouseOver" />
- <PUBLIC:ATTACH EVENT="onmouseout" HANDLER="DoMouseOut" />
-
- <PUBLIC:METHOD NAME="SelectTab" />
-
- <PUBLIC:EVENT NAME="onShowPage" ID="spID"/>
-
- <PUBLIC:PROPERTY NAME="title" />
- <PUBLIC:PROPERTY NAME="src" />
- <PUBLIC:PROPERTY NAME="selectedImg"/>
- <PUBLIC:PROPERTY NAME="img" />
- <PUBLIC:PROPERTY NAME="ColorBorder" />
- <PUBLIC:PROPERTY NAME="ColorSelectedTab" />
- <PUBLIC:PROPERTY NAME="ColorSelectedTabText" />
- <PUBLIC:PROPERTY NAME="ColorGrayedTab" />
- <PUBLIC:PROPERTY NAME="ColorGrayedTabText" />
- <PUBLIC:PROPERTY NAME="ColorTab" />
- <PUBLIC:PROPERTY NAME="ColorTabText" />
- <PUBLIC:PROPERTY NAME="ColorTabTextMouseOver" />
- <PUBLIC:PROPERTY NAME="FontStyle" />
- <PUBLIC:PROPERTY NAME="selected" />
- <PUBLIC:PROPERTY NAME="grayed" />
- <PUBLIC:PROPERTY NAME="label" />
- <PUBLIC:PROPERTY NAME="margin" />
- <PUBLIC:PROPERTY NAME="topDiv" />
- <PUBLIC:PROPERTY NAME="tmDiv" />
- <PUBLIC:PROPERTY NAME="tmoDiv" />
- <PUBLIC:PROPERTY NAME="botDiv" />
- <PUBLIC:PROPERTY NAME="bmDiv" />
- <PUBLIC:PROPERTY NAME="noDiv" />
-
- <SCRIPT LANGUAGE="jscript">
-
- var g_curColor = "";
- var g_curIndex = 0;
-
- function DoInit() {
- SetDefaults();
- BuildTabStrip();
- }
-
- /*
- // SetDefaults
- // Sets default values and initializes some common-use variables
- */
- function SetDefaults() {
-
- if (FontStyle == null)
- FontStyle = "font-Family:Tahoma,Arial,Verdana;font-Size:11px;font-weight:bold;";
- if (ColorTab == null)
- ColorTab = "#CC0033";
- if (ColorTabText == null)
- ColorTabText = "#FFFFFF";
- if (ColorGrayedTab == null)
- ColorGrayedTab = "#000000";
- if (ColorGrayedTabText == null)
- ColorGrayedTabText = "gainsboro";
- if (ColorSelectedTab == null)
- ColorSelectedTab = "#FFFFFF";
- if (ColorSelectedTabText == null)
- ColorSelectedTabText = "#000000";
- if (ColorTabTextMouseOver == null)
- ColorTabTextMouseOver = "#CC0033";
- if (ColorBorder == null)
- ColorBorder = "#CC0033";
- if (label == null)
- label = "";
- if (margin == null)
- margin = 0;
-
- aSrcs = new Array();
- aSelectedImg = new Array();
- aImg = new Array();
-
- aDisabled = new Array();
- selItem = 0;
- window.document.body.style.margin = margin;
- }
-
- /*
- // BuildTabStrip
- // Creates the (rather complex) structure of <TABLE> to provide
- // the tabs. Loops through the child items to extract info
- */
- function BuildTabStrip() {
-
- // begin group
- str = "<table border=0 cellpadding=0 cellspacing=0 height=100% width=100% valign=top>"
-
- // loops through children
- for (i=0; i<children.length; i++) {
-
- aSrcs[i] = children[i].src;
- aSelectedImg[i] = children[i].selectedImg;
- aImg[i] = children[i].img;
-
- // Normal status settings
- aDisabled[i] = 0;
- sColorTab = ColorTab;
- sTitle = children[i].title;
- sForeColor = ColorTabText;
-
- // Grayed status settings
- if (children[i].grayed != null) {
- aDisabled[i] = 1;
- sTitle = "<i>" + children[i].title + "</i>";
- sColorTab = ColorGrayedTab;
- sForeColor = ColorGrayedTabText;
- }
-
- if (children[i].selected != null) {
- if (selItem == 0) selItem = i;
- sForeColor = ColorSelectedTabText;
- }
-
- // text for children
- str += "<tr><td width=1 bgcolor='"+ColorBorder+"'></td><td valign=top>";
-
- str += "<table border=0 id=myTable cellpadding=0 cellspacing=0>";
- str += "<tr width=94 height=17><TD colspan=4 bgcolor='"+ColorSelectedTab+"'>"
- str += "<img id=myBDiv width=94 height=17 bgcolor='" + ColorSelectedTab + "' border=0 src='"+noDiv+"'></td></tr>"
- str += "<tr><td width=2 bgcolor='"+ColorBorder+"'><img border=0 width=2 height=0></td><td height=66 style='cursor:hand;' width=80 id=myTD align=center ";
- str += "style=" + FontStyle + "color:" + sForeColor + ">";
- if (null != children[i].img)
- str += "<img align=center id=myIMG src=" + children[i].img + "><br>";
- str += sTitle;
- str += "</td><td id=myRtBorder width=2 bgcolor='"+ColorBorder+"'><img border=0 width=2 height=0></td>"
- str += "<td width=10 bgcolor='white'><img border=0 width=2 height=0></td></tr>"
- str += "</table></td></tr>";
-
- }
-
- str += "<tr height=100% width=100%><td width=1 bgcolor='"+ColorBorder+"'><img border=0 width=1></td><td valign=top>"
- str += "<table border=0 height=100% cellpadding=0 cellspacing=0 border=0><tr height=17><td colspan=4 bgcolor='"+ColorSelectedTab+"'>"
- str += "<img id=myBDiv width=94 height=17 border=0 src='"+noDiv+"'></td></tr>"
- str += "<tr height=100%><td width=2 bgcolor='"+ColorBorder+"'><img border=0 width=2 height=0></td>"
- str += "<td width=80 bgcolor='"+ColorTab+"'><img border=0 width=80 height=0></td><td width=2 bgcolor='"+ColorBorder+"'><img border=0 width=2 height=0></td>"
- str += "<td width=10 bgcolor='"+ColorSelectedTab+"'><img border=0 width=2 height=0></td></tr>"
-
- str += "</table></td></tr> <tr><td width=1 bgcolor='"+ColorBorder+"'></td><td valign=top>";
- str += "<table border=0 height=100% cellpadding=0 cellspacing=0 border=0><tr height=17><td bgcolor='"+ColorSelectedTab+"'>"
- str += "<img id=myBDiv width=94 height=17 border=0 src='"+bmDiv+"'></td></tr></table></td></tr>"
- str += "<tr><td colspan=2 height=1 bgcolor='"+ColorBorder+"'></td></tr>"
-
- // ends group
- str += "</table>";
-
- // writes to the page
- element.innerHTML = str;
-
- myBDiv[0].src = tmDiv
- // hilites the selected element in the tabstrip
- HiliteItem(selItem);
-
- oEvent = createEventObject();
- oEvent.result = aSrcs[selItem].toString();
- spID.fire(oEvent);
- }
-
-
- /*
- // DoClick
- // Executes the code in response to a user click on a tab.
- // Basically, it switches between child pages and changes
- // UI features
- */
- function DoClick()
- {
- eTD = window.event.srcElement;
- ResetTabs(eTD);
- }
-
- function ResetTabs(eTD)
- {
- try
- {
- tabName = eTD.innerText;
-
- if (eTD.id == "myIMG")
- {
- for (i=0; i<myIMG.length; i++)
- {
- if (!aDisabled[i])
- {
- if (myIMG[i].src == eTD.src)
- eTD = myTD[i];
- }
- }
- }
-
- if (eTD.id != "myTD") return;
- if (eTD.style.color == ColorGrayedTabText) return;
- if (eTD.style.color == ColorSelectedTabText) return;
-
- if (!aDisabled[g_curIndex]) {
- myTD[g_curIndex].style.background = ColorTab;
- myTD[g_curIndex].style.color = ColorTabText;
- myTD[g_curIndex].style.cursor = "hand";
- myTable[g_curIndex].style.background = ColorTab;
- //myTD[g_curIndex].style.fontWeight = "";
- if (0 == g_curIndex)
- myBDiv[g_curIndex].src = tmDiv
- else
- myBDiv[g_curIndex].src = noDiv
- myBDiv[g_curIndex+1].src = noDiv
-
- if (null != aImg[g_curIndex])
- myIMG[g_curIndex].src = aImg[g_curIndex]
-
- myRtBorder[g_curIndex].style.background = ColorBorder
- }
-
- for (i=0; i<myTD.length; i++)
- {
- if (myTD[i].innerHTML == eTD.innerHTML)
- selItem = i;
- }
-
- g_curColor = ColorSelectedTabText;
- HiliteItem(selItem);
-
- oEvent = createEventObject();
- oEvent.result = aSrcs[selItem].toString();
- spID.fire(oEvent);
- }
- catch (e)
- {
- }
- }
-
- function SelectTab(index)
- {
- var eTD;
-
- eTD = myIMG[index];
- ResetTabs(eTD);
- HiliteItem(index);
-
- oEvent = createEventObject();
- oEvent.result = aSrcs[selItem].toString();
- spID.fire(oEvent);
- }
-
- /*
- // HiliteItem
- // Changes the UI attributes for the selected tab
- */
- function HiliteItem(index)
- {
- try
- {
- myTD[index].style.background = ColorSelectedTab;
- myTable[index].style.background = ColorSelectedTab;
- myTD[index].style.color = ColorSelectedTabText;
- myTD[index].style.cursor = "default";
-
- if (0 == index)
- myBDiv[index].src = tmoDiv
- else
- myBDiv[index].src = topDiv
-
- myBDiv[index+1].src = botDiv
-
- if (null != aSelectedImg[index])
- {
- myIMG[index].src = aSelectedImg[index]
- }
-
- myRtBorder[index].style.background = ColorSelectedTab
- g_curIndex = index;
- }
- catch (e)
- {
- }
- }
-
-
- /*
- // DoMouseOver
- // Executes the code to highlight the tab where the mouse
- // is currently hovering over
-
- function DoMouseOver() {
- eTD = window.event.srcElement;
- g_curColor = eTD.style.color;
- if (eTD.tagName == "TD") {
- if (eTD.style.background != ColorSelectedTab &&
- eTD.innerText != "" &&
- eTD.style.color != ColorGrayedTabText &&
- eTD.id == "myTD")
- {
- //eTD.style.color = ColorTabTextMouseOver;
- //eTD.style.textDecoration = "underline";
- //eTD.style.cursor = "hand";
- }
- else {
- //eTD.style.cursor = "default";
- }
- }
- //else if (eTD.tagName == "IMG")
- //{
- // eTD.style.cursor = "hand";
- //}
- }
-
- function DoMouseOut() {
- eTD = window.event.srcElement;
- if (eTD.style.color != ColorGrayedTabText) {
- //eTD.style.cursor = "";
- eTD.style.color = g_curColor; //"";
- //eTD.style.textDecoration = "none";
- }
- }
- */
-
- </SCRIPT>
-
- </PUBLIC:HTC>